import {
  ArgumentMetadata,
  Inject,
  Optional,
  PipeTransform,
} from '@nestjs/common';
import { Injectable } from '@nestjs/common';

@Injectable()
export class DemoPipe implements PipeTransform {
  @Optional()
  @Inject('validation_options')
  private options;

  transform(value: any, metadata: ArgumentMetadata) {
    console.log('==========options');
    console.log(this.options);

    console.log('=====demoPipe====');
    console.log(value);
    console.log(metadata);
    const { metatype } = metadata;
    console.log(metatype);
    return value;
  }
}

// class-validator + class-transformer
